#include <iostream>
#include <fstream>
using namespace std;

int main(int argc, char const *argv[])
{
	// const int MAX_LENGTH = 24;
	// char s1[MAX_LENGTH];
	// char s2[MAX_LENGTH];
	// char s3[MAX_LENGTH];
	// int s4;
	// std::ifstream t;
	// int length;
	// t.open("Binary.dat");      // open input file  
	// t.seekg(0, std::ios::end);    // go to the end  
	// length = t.tellg();           // report location (this is the length)  
	// t.seekg(0, std::ios::beg);    // go back to the beginning  
	// char* buffer0 = new char[length];    // allocate memory for a buffer of appropriate dimension  
	// t.read(buffer0, length);       // read the whole file into the buffer  
	// t.close();                    // close file handle  
	// // cout << "close" << endl;
	// // cout << "len:  " << length << endl;
	// int x = 0;
	// for (int i = 0; i < length; i = i + 72) {
	// 	for (int j = 0; j < 24; j++)
	// 		s1[j] = buffer0[i + j];
	// 	for (int j = 0; j < 24; j++)
	// 		s2[j] = buffer0[24 + i + j];
	// 	for (int j = 0; j < 24; j++)
	// 		s3[j] = buffer0[48 + i + j];
	// 	cout << s1 << " " << s2 << " " << s3 << endl;
	// }
	// delete[]buffer0;

	const int MAX_LENGTH = 24;
	char s0[MAX_LENGTH];
	char s1[MAX_LENGTH];
	char s2[MAX_LENGTH];
	char s3[MAX_LENGTH];
	int s4;
	std::ifstream t;
	int length;
	t.open("Ternary.dat");      // open input file  
	t.seekg(0, std::ios::end);    // go to the end  
	length = t.tellg();           // report location (this is the length)  
	t.seekg(0, std::ios::beg);    // go back to the beginning  
	char* buffer0 = new char[length];    // allocate memory for a buffer of appropriate dimension  
	t.read(buffer0, length);       // read the whole file into the buffer  
	t.close();                    // close file handle  
	int x = 0;
	for (int i = 0; i < length; i = i + 96) {
		for (int j = 0; j < 24; j++)
			s0[j] = buffer0[i + j];
		for (int j = 0; j < 24; j++)
			s1[j] = buffer0[24 + i + j];
		for (int j = 0; j < 24; j++)
			s2[j] = buffer0[48 + i + j];
		for (int j = 0; j < 24; j++)
			s3[j] = buffer0[72 + i + j];
		cout << s0 << " " << s1 << " " << s2 << " " << s3 << endl;
	}
	delete[]buffer0;
	return 0;
}